﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-11-09 08:14:31
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
Description :   Bll_OS层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_sys_DICTIONARY的摘要说明。
	/// </summary>
    public partial class   Bll_yw_pfdB
  	{ 
     		      
  		private readonly Dal_yw_pfdB dal=new  Dal_yw_pfdB(); 
  		public  Bll_yw_pfdB() 
  		{} 
  		 
  		#region  Method 
     		      
  		public bool Exists(int DjLsh) 
  		{ 
  			return dal.Exists(DjLsh); 
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public bool  Add(yw_pfdB_Entity model) 
  		{ 
  			return dal.Add(model); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(yw_pfdB_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(yw_pfdB_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据(字符串) 
  		/// </summary> 
  		public string UpdateStr(yw_pfdB_Entity model) 
  		{ 
  			return dal.UpdateStr(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(int DjLsh) 
  		{ 
  			 
  			return dal.Delete(DjLsh); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			return dal.DeleteList(lists ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public yw_pfdB_Entity  GetModel(int DjLsh) 
  		{ 
  			 
  			return dal.GetModel(DjLsh); 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  		/// <summary> 
  		/// 获得数据count 
  		/// </summary> 
  		public int GetCount(string strWhere) 
  		{ 
  			return dal.GetRecordCount(strWhere); 
  		} 
  	 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_pfdB_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_pfdB_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_pfdB_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<yw_pfdB_Entity> modelList = new List<yw_pfdB_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				yw_pfdB_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  				model = new yw_pfdB_Entity();					 
  			    
			      if (dt.Rows[n]["DjLsh"] != null && dt.Rows[n]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[n]["DjLsh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjBth"] != null && dt.Rows[n]["DjBth"].ToString() != "")
                model.DjBth = int.Parse(dt.Rows[n]["DjBth"].ToString());
			  
	        model.DjState = dt.Rows[n]["DjState"].ToString();
	        
			      if (dt.Rows[n]["hh"] != null && dt.Rows[n]["hh"].ToString() != "")
                model.hh = int.Parse(dt.Rows[n]["hh"].ToString());
			  
	        model.spbh = dt.Rows[n]["spbh"].ToString();
	        model.sptm = dt.Rows[n]["sptm"].ToString();
	        model.spmc = dt.Rows[n]["spmc"].ToString();
	        model.cjhh = dt.Rows[n]["cjhh"].ToString();
	        if (dt.Rows[n]["gg"] != null && dt.Rows[n]["gg"].ToString() != "")
			  model.gg = decimal.Parse(dt.Rows[n]["gg"].ToString());
			
	        model.dw = dt.Rows[n]["dw"].ToString();
	        model.ys = dt.Rows[n]["ys"].ToString();
	        model.flh = dt.Rows[n]["flh"].ToString();
	        model.flmc = dt.Rows[n]["flmc"].ToString();
	        model.xlbh = dt.Rows[n]["xlbh"].ToString();
	        model.xlmc = dt.Rows[n]["xlmc"].ToString();
	        if (dt.Rows[n]["sl"] != null && dt.Rows[n]["sl"].ToString() != "")
			  model.sl = decimal.Parse(dt.Rows[n]["sl"].ToString());
			
	        if (dt.Rows[n]["dj"] != null && dt.Rows[n]["dj"].ToString() != "")
			  model.dj = decimal.Parse(dt.Rows[n]["dj"].ToString());
			
	        if (dt.Rows[n]["je"] != null && dt.Rows[n]["je"].ToString() != "")
			  model.je = decimal.Parse(dt.Rows[n]["je"].ToString());
			
	        if (dt.Rows[n]["jj"] != null && dt.Rows[n]["jj"].ToString() != "")
			  model.jj = decimal.Parse(dt.Rows[n]["jj"].ToString());
			
	        if (dt.Rows[n]["jjje"] != null && dt.Rows[n]["jjje"].ToString() != "")
			  model.jjje = decimal.Parse(dt.Rows[n]["jjje"].ToString());
			
	        if (dt.Rows[n]["zhje"] != null && dt.Rows[n]["zhje"].ToString() != "")
			  model.zhje = decimal.Parse(dt.Rows[n]["zhje"].ToString());
			
	        if (dt.Rows[n]["kcsl"] != null && dt.Rows[n]["kcsl"].ToString() != "")
			  model.kcsl = decimal.Parse(dt.Rows[n]["kcsl"].ToString());
			
	        if (dt.Rows[n]["ddwjsl"] != null && dt.Rows[n]["ddwjsl"].ToString() != "")
			  model.ddwjsl = decimal.Parse(dt.Rows[n]["ddwjsl"].ToString());
			
	        if (dt.Rows[n]["hzk"] != null && dt.Rows[n]["hzk"].ToString() != "")
			  model.hzk = decimal.Parse(dt.Rows[n]["hzk"].ToString());
			
	        model.xsxc = dt.Rows[n]["xsxc"].ToString();
	        model.hbz = dt.Rows[n]["hbz"].ToString();
	        model.sfdz = dt.Rows[n]["sfdz"].ToString();
	        model.gysbh = dt.Rows[n]["gysbh"].ToString();
	        if (dt.Rows[n]["pfj"] != null && dt.Rows[n]["pfj"].ToString() != "")
			  model.pfj = decimal.Parse(dt.Rows[n]["pfj"].ToString());
			
	        model.bmbh1 = dt.Rows[n]["bmbh1"].ToString();
	        model.bmmc1 = dt.Rows[n]["bmmc1"].ToString();
	        model.gysmc = dt.Rows[n]["gysmc"].ToString();
	        if (dt.Rows[n]["zhdj"] != null && dt.Rows[n]["zhdj"].ToString() != "")
			  model.zhdj = decimal.Parse(dt.Rows[n]["zhdj"].ToString());
			
	        if (dt.Rows[n]["dalsj"] != null && dt.Rows[n]["dalsj"].ToString() != "")
			  model.dalsj = decimal.Parse(dt.Rows[n]["dalsj"].ToString());
			
	        if (dt.Rows[n]["gyszk"] != null && dt.Rows[n]["gyszk"].ToString() != "")
			  model.gyszk = decimal.Parse(dt.Rows[n]["gyszk"].ToString());
			
	        
  				 modelList.Add(model); 
  				}
  			}
  		}
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 批量处理 
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error ) 
  		{ 
  			return dal.ExecuteSqlTran(ls,ref   error); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return dal.ExecuteSql(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			return dal.GetSingle(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public DataTable ExecuteDt(string sql) 
  		{ 
  			return dal.ExecuteDt(sql); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
